#ifndef PLANE_HPP
#define PLANE_HPP

#include "shape.hpp"

class Plane : public Shape {
public:
  /**
   * @brief Default Constructor
   * @note  The Normal is oriented the same as z-axis, the origin is 0
   * @retval
   */
  Plane();

  /**
   * @brief  Construct a plane use normal and d
   * @note
   * @param  n: the normal about the plane
   * @param  o: a point in the plane
   * @retval
   */
  Plane( vec3f n, vec3f o );

  /**
   * @brief  Construct a plane use three position and origin
   * @note
   * @param  v1: the first position
   * @param  v2: the second position
   * @param  v3: the third position
   * @param  o: the point in the plane
   * @retval
   */
  Plane( vec3f v1, vec3f v2, vec3f v3, vec3f o );

  vec3f &normal() { return _n; }
  const vec3f &normal() const { return _n; }

  vec3f &origin() { return _o; }
  const vec3f &origin() const { return _o; }

  /**
   * @brief  Judge whether the ray is intersect with the plane
   * @note   just compute if it is parallel with the plane normal
   * @param  r: the ray to test
   * @retval
   */
  bool parallel( const Ray &r ) const;

  vec3f color;

private:
  vec3f _n;
  vec3f _o;

  SHAPE_HIT_SIGNITURE
};

#endif